function [dataFD]=FCForceDist(data,k,c)

% Modified 2014-08-28
% Zeros force curves, finds c (constant compliance) values.
%
% INPUT:
%           data - structure with .app and .ret, each containing a cell 
% array of delta_z (um) v. deflection_nA (nA).
%           k - spring constant (0.2 N/m)
%           c - slope of constant compliance region (nm/nA) (Previously calculated using FCfindc)


z = data(:,1).*1000;        %Gives z piezo height in nm
dnm = data(:,2).*c  ;  %Gives deflection in nm

if length(z)~=length(dnm)         %Sometimes, weirdly, different number of points in z v. dnm data. This corrects the issue.
    z = z(1:length(dnm));
end

%See Passeri Berezina 2009 for a good walk-through of this process

h = (z)./1000; %For Figure 4 & 5
%h = (z + dnm + (dnm.*k/0.3))./1000;     %subtract deflection and droplet deformation (For Figure 6 and 9(A))
%0.3 in above line is droplet stiffness (calculated using relevant Froce-Displacement curve)

%Translate dnm into force (nN)
F = dnm.*k;

dataFD = [h F];